package com.icinfo.cloud.provider.punish.controller;

import com.icinfo.cloud.provider.punish.dto.DocumentReplenishAmendQueryDto;
import com.icinfo.cloud.provider.punish.dto.DocumentReplenishAmendSaveDto;
import com.icinfo.cloud.provider.punish.service.IDocumentReplenishAmendService;
import com.icinfo.cloud.provider.punish.vo.DocumentReplenishAmendDetailVo;
import com.icinfo.framework.common.web.Result;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


/**
 * 描述：文书补正更正Controller类.<br>
 *
 * @author shishengyao
 * @description
 * @date 2023/2/20
 */
@RestController
@RequestMapping("/app/document/replenish/amend")
@Slf4j
public class DocumentReplenishAmendController {
    @Resource
    private IDocumentReplenishAmendService documentAmendService;

    /**
     * 【V1.11.0】描述：补正/更正文书
     *
     * @return {@link Result }
     * @author shishengyao
     * @date 2023/02/20
     */
    @PostMapping("/replenishAmendDocument")
    @ApiOperation(value = "【V1.0.0】描述：补正/更正文书接口", httpMethod = "POST")
    public Result replenishAmendDocument(@RequestBody @Validated DocumentReplenishAmendSaveDto saveDto) {
        int count = documentAmendService.replenishAmendDocument(saveDto);
        if(count>0){
            return Result.success("补正更正保存成功");
        }
        return Result.error("补正更正保存失败");
    }


    /**
     * 【V1.11.0】描述：获取补正/更正文书详情
     *
     * @return {@link Result }
     * @author shishengyao
     * @date 2023/02/20
     */
    @PostMapping("/geReplenishAmendDetail")
    @ApiOperation(value = "【V1.0.0】描述：获取补正/更正文书详情接口", httpMethod = "POST")
    public Result<DocumentReplenishAmendDetailVo> geReplenishAmendDetail(@RequestBody @Validated DocumentReplenishAmendQueryDto queryDto) {
        DocumentReplenishAmendDetailVo documentReplenishAmendDetailVo = documentAmendService.getReplenishAmendDetail(queryDto);
        return Result.success(documentReplenishAmendDetailVo);
    }
}
